package com.donglan.pethome.basic.config;

import com.donglan.pethome.user.interceptor.LoginInterceptor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * @Author: zhangdonghui
 * @Date: 2022/1/20 16:07
 */
@Configuration
public class donglanWebMvcConfigurer implements WebMvcConfigurer {

    @Autowired
    private LoginInterceptor loginInterceptor;

    /*
     *  拦截器拦截 /* 和 /** 的区别：
     *          /* ： 匹配一级，即 /add , /query 等
     *          /** ： 匹配多级，即 /add , /add/user, /add/user/user… 等
     * */
    @Override
    public void addInterceptors(InterceptorRegistry registry) {
                /*registry.addInterceptor(loginInterceptor)
                        .addPathPatterns("/**")
                        .excludePathPatterns("/user/login")
                        .excludePathPatterns("/user/register");*/

    }
}
